<?php

namespace app\index\controller\consulting;

use app\index\model\UM as UM;
use app\index\service\MoreServerService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use think\APP;
use think\Request as Request;

/**
 * MoreServer 控制器
 * Class MoreServer
 * @package app\consulting\controller
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 */
class MoreServer
{
    // 请求参数
    private Request $request;

    // service
    private MoreServerService $service;

    public function __construct(Request $request, MoreServerService $moreServerService)
    {
        $this->request = $request;
        $this->service = $moreServerService;
    }

    /**
     * 更多服务 列表
     * @param \app\index\model\UM|null $user
     * @return ApiResponse
     * @url /consulting/more_server/index
     */
    public function index(?UM $user): ApiResponse
    {
        $request     = $this->request;

        $page      = $request->param('page', 1);
        $page_size = $request->param('page_size', 20);

        return ApiResponse::success($this->service->index($user, $page, $page_size));
    }

}
